Advanced Analytics with Transact-SQL by Dejan Sarka

Advanced Analytics with Transact-SQL by Dejan Sarka

Author:Dejan Sarka
Language: eng
Format: epub
ISBN: 9781484271735
Publisher: Apress


SupplierId

From

To

S1

D04

D10

S2

D02

D04

S2

D07

D10

In Table 5-1, the supplier was under contract in two different time intervals. Table 5-2 shows the supplies of the products for the two suppliers in Table 5-1.Table 5-2Timestamped Product Supplies Table

SupplierId

ProductId

From

To

S1

P1

D05

D07

S2

P1

D09

D10

S2

P2

D02

D03

S2

P2

D08

D10

If you join the two tables on the supplier ID only, you get rows that should not be in the results. For example, you could get a row with supplier S2 from D02 to D04 joined with the row for supplier S2 product P1 from D09 to D10. This row never existed in the database.

The from and to timepoints in both tables do not give a time unit. The time unit, or the time granularity, depends on the business’s needs. For contracts, the granularity of a day is usually appropriate. You can always work with integers instead of points of time and use a lookup table to add the units or give the integers time context.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.